{include file="header.tpl" jsload="ajax" jsload1="tinymce"}
{include file="tabsmenue-admin.tpl" participanttab="active"}
<div id="content-left">
	<div id="content-left-in">
		<div class="projects">
			<div class="infowin_left" style="display:none;" id="systemmsg">

				{if $mode == "edited"}
				<span class="info_in_yellow">
					<img src="templates/{$settings.template}/theme/{$settings.theme}/images/symbols/customers.png" alt="" />
					{#participantwasedited#}
				</span>				
				{elseif $mode == "added"}
				<span class="info_in_green">
					<img src="templates/{$settings.template}/theme/{$settings.theme}/images/symbols/customers.png" alt="" />
					{#participantwasadded#}
				</span>
				{elseif $mode == "deleted"}
				<span class="info_in_red">
					<img src="templates/{$settings.template}/theme/{$settings.theme}/images/symbols/customers.png" alt="" />
					{#participantsweredeleted#}
				</span>
				{/if}

			</div>

			{literal}
				<script type="text/javascript">
					systemMsg('systemmsg');
				</script>
			{/literal}
			
			<h1>{#administration#}<span>/ {#participantadministration#}</span></h1>
			<form id = "search" method = "post" action = "admin.php?action=searchparticipants" >
				<fieldset>
				<div class = "row">
					<input type="text" class = "text" id="query_modal" name="tag" style="background-color: #C4D2D3;float:right" placeholder="Search a Participant"/>
				</div>				
				<button type="submit" "style="display:none;"></button>
				</fieldset>
			</form>
			<div class="headline">
				<a href="javascript:void(0);" id="acc-participants_toggle" class="win_none" onclick="toggleBlock('acc-participants');"></a>
				<div class="wintools">
					
				</div>				

				<h2>
					<img src="./templates/{$settings.template}/theme/{$settings.theme}/images/symbols/customers.png" alt="" />
						{#participantlist#}
				</h2>
			</div>
			<div class="block" id="acc-participants"> {*Add Participant*}
				<div id="form_addparticipant" class="addmenue" style="display:none;">
					{include file="addparticipant.tpl"}
				</div>
				<div id="form_editparticipant" class="addmenue" style="display:none;">
					{include file="editparticipant.tpl"}
				</div>
				<div class="nosmooth" id="sm_customers">
					<table id="adminparticipants" cellpadding="0" cellspacing="0" border="0">
						<thead>
							<tr>
								<th class="a"><input type="checkbox" id="allParticipants" onclick="selectAll(this);check();"/></th>
								<th class="b">{#participant#}</th>
								<th class="c">{#type#}</th>
								<th class="d">{#phone#}</th>
								<th class="d">{#email#}</th>
								<th class="tools"></th>
							</tr>
						</thead>						
						
						<tfoot>
							<tr>
								<td colspan="5"></td>
							</tr>
						</tfoot>	
						{section name=participant loop=$participants}
							{*Color-Mix*}
							{if $smarty.section.participant.index % 2 == 0}
								<tbody class="color-a" id="proj_{$participants[participant].ID}">
							{else}
								<tbody class="color-b" id="proj_{$participants[participant].ID}">
							{/if}
							<tr>
								<td><input type="checkbox" class="checkbox1" name="participants" id="{$participants[participant].ID}" onclick="check();" /></td>
								<td>
									<div class="toggle-in">
										<span class="acc-toggle" onclick="javascript:accord_participants.activate($$('#acc-participants .accordion_toggle')[{$smarty.section.participant.index}]);toggleAccordeon('acc-participants',this);">
											{$participants[participant].name}
										</span>
										
									</div>
								</td>
								<td>{$participants[participant].type_name}</td>
								<td>{$participants[participant].phone}</td>
								<td>{$participants[participant].email}</td>
								<td class="tools">
										{if $userpermissions.participants.edit}
										<a class="tool_edit" href="javascript:void(0);" onclick="change('admin.php?action=editformparticipant&amp;id={$participants[participant].ID}','form_editparticipant');toggleClass(this,'tool_edit_active','tool_edit');blindtoggle('form_editparticipant');" title="{#edit#}"></a>									
										{/if}
										
										{if $userpermissions.participants.del}
										<a class="tool_del" href="javascript:void(0);" onclick="change('admin.php?action=deleteparticipant&amp;id={$participants[participant].ID}', 'form_editparticipant');" title="{#delete#}"></a>
										{/if}
								</td>
							</tr>
								<tr class="acc">
									<td colspan="5">
										<div class="accordion_toggle"></div>
										<div class="accordion_content">
											<div class="acc-in">

												<table id="adminparticipants" cellpadding="0" cellspacing="0" border="0">
													<tr>
														<td>{#contactperson#}:</td>
														<td>{$participants[participant].contactPerson}</td>
														<td rowspan="3" style="vertical-align:top;">{#address#}:</td>
														<td>{$participants[participant].address}</td>
													</tr>
													<tr>
														<td>{#cellphone#}:</td>
														<td>{$participants[participant].phone}</td>
														<td>{$participants[participant].country} {$participants[participant].city}</td>
													</tr>
													<tr>
														<td>{#url#}:</td>
														<td><a href="{$participants[participant].url}" target="_blank">{$participants[participant].url}</a></td>
													</tr>
												</table>

											</div>
										</div>
									</td>
								</tr>
							</tbody>
						{/section}
		
					</table>
				</div>
				<div class="tablemenue">
					<div class="tablemenue-in">
						{if $userpermissions.admin.add|default}
							<a class="butn_link" href="javascript:blindtoggle('form_addparticipant');" id="add_butn_participants" onclick="Effect.BlindUp('form_editparticipant');toggleClass('add_participants','add-active','add');toggleClass(this,'butn_link_active','butn_link');toggleClass('sm_participants','smooth','nosmooth');">{#addparticipant#}</a>
						{/if}
						
							<button class="butn_link" href="javascript:void(0);" onclick="getChecked();" id="delete_butn_participants" disabled>{#deleteselection#}</button>
							<form method="POST"  action="admin.php?action=deleteparticipants" id="deleteallform">
								<input type="hidden" id="participantsID" name="participantsID"/>
							</form>
					</div>
				</div>
			</div>
			{literal}
				<script type="text/javascript">
					function selectAll(source) {
  						checkboxes = document.getElementsByName('participants');
  						for(var i=0, n=checkboxes.length;i<n;i++) {
   							checkboxes[i].checked = source.checked;
  						}
					}
					function check() {
						if(document.getElementById("allParticipants").checked == true){
							document.getElementById("delete_butn_participants").removeAttribute("disabled");
						}else if(document.getElementById("allParticipants").checked == false){
							document.getElementById("delete_butn_participants").setAttribute("disabled", true);
						}
						checkboxes = document.getElementsByName('participants');
						var count = 0;
  						for(var i=0, n=checkboxes.length;i<n;i++) {
   							if(checkboxes[i].checked == true){
								count++;
							}
  						}
						if(count > 0){
							document.getElementById("delete_butn_participants").removeAttribute("disabled");
						}
						if(count == 0){
							document.getElementById("delete_butn_participants").setAttribute("disabled", true);
							document.getElementById("allParticipants").checked = false;
						}
					}
					function getChecked() {
						checkboxes = document.getElementsByName('participants');
						var participantsID = [];
						for(var i=0, n=checkboxes.length;i<n;i++) {
   							if(checkboxes[i].checked){
								participantsID.push(checkboxes[i].id)
							}
  						}
						document.getElementById("participantsID").value = participantsID;
						document.getElementById("deleteallform").submit();
					}

												
				</script>
			{/literal}
			{literal}
				<script type="text/javascript">
					var accord_participants = new accordion('acc-participants');
				</script>
			{/literal}
			<div class="content-spacer"></div>
		</div>
	</div>
</div>

{include file="sidebar-a.tpl"}
{include file="footer.tpl"}